<template>
	<view class="u-padding-20">
		<view class="shadow_con u-padding-20 u-rela">
			<view class="list">
				服务项目：<text style="color:#000;">{{detail.title}}</text>
			</view>
			<view class="list">
				看护时间：{{detail.memo}}
			</view>
			<view class="list">
				看护费用：{{detail.fee}}元/天
			</view>
			<view :style="{color:color}" class="u-abso dis_inl_blo pos_right pos_top">
				{{detail.status_label}}
			</view>
		</view>
		<view class="shadow_con u-padding-20 u-margin-top-20">
			<!-- <view class="list">
				预约时间：2022.5.20
			</view> -->
			<view class="list">
				服务总费用：{{detail.fee*detail.during}}元
			</view>
			<view class="list">
				服务天数：{{detail.during}}
			</view>
			<view class="list">
				服务时间：{{detail.time}}
			</view>
		</view>
		<view class="shadow_con u-padding-20 u-margin-top-20">
			<view class="list">
				老人姓名：{{detail.older_name}}
			</view>
			<view class="list">
				老人年龄：{{detail.older_age}}岁
			</view>
			<view class="list">
				老人性别：{{detail.older_sex?'女':'男'}}
			</view>
			<view class="list">
				房屋信息：{{detail.house}}
			</view>
			<view class="list">
				联 系 人：{{detail.name}}
			</view>
			<view class="list u-rela">
				联系电话：{{detail.tel}}
				<u-icon style="bottom:10rpx;" class="u-abso pos_right" color="#008b00" name="phone-fill" size="40" @click="makephone(detail.tel)"></u-icon>
			</view>
		</view>
		<view class="list u-margin-top-20" v-if="detail.status!=0">
			工单信息
		</view>
		<view class="shadow_con u-padding-20 u-margin-top-20 u-rela" v-if="detail.status!=0">
			<view class="list">
				负责人：{{detail.examine.author}}
			</view>
			<view class="list">
				进度时间：{{detail.examine.update_time}}
			</view>
			<view class="list">
				负责人审核备注：{{detail.examine.memo}}
			</view>
		</view>
		<view v-if="detail.status==0" style="margin-top:100rpx;" class="u-padding-15 u-text-center">
			<u-button class="u-margin-right-50" type="success" shape="circle" @click="torelease" size="medium">审核通过</u-button>
			<u-button type="default" shape="circle" @click="toNorelease" size="medium">审核拒接</u-button>
			
		</view>
		<u-mask :show="show" @click="show = false">
			<view class="warp">
				<view class="rect" @tap.stop>
					<textarea v-model="reasontext" placeholder="请输入原因:例如信息核实/信息不符合" />
					<button class="btn_con1 margin_auto u-margin-top-20" @click="sureSubmit">确认提交</button>
				</view>
			</view>
		</u-mask>
		<!-- 弹框提示 -->
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	import {
		getAdjacentOlderDetail,
		examineAdjacentOlder
	} from "@/service/shareService.js";
	export default {
		data () {
			return {
				id:0,
				detail:{},
				color:'#333',
				show:false,
				isagreeStatus:1,
				reasontext:''      //备注放行或不放行的原因
			}
		},
		onLoad(options) {
			this.id=options.id
			getAdjacentOlderDetail({
				id: options.id
			}).then(this.getDetail);
		},
		methods:{
			getDetail(e) {
				// console.log(e);
				if(e.code == 200){
					this.detail = e.result;
					if(e.result.status==0){
						this.color='#007AFF'
					}else if(e.result.status==1){
						this.color='#00aa00'
					}else if(e.result.status==2){
						this.color='#ff0000'
					}else if(e.result.status==3){
						this.color='#000000'
					}else if(e.result.status==-1){
						this.color='#ff5500'
					}
				}
			
				
			},
			torelease:function(){
				this.show=true;
				this.isagreeStatus=1;
				this.reasontext='信息核实，通过审核'
			},
			toNorelease:function(){
				this.show=true;
				this.isagreeStatus=-1;
				this.reasontext='信息不符合，不通过审核'
			},
			sureSubmit:function(){
				let id=this.id;
				let status=this.isagreeStatus;
				let memo=this.reasontext;
				examineAdjacentOlder({
					id: id,
					status:status,
					memo:memo
				}).then(res=>{
					// console.log(res);
					if(res.code==200){
						this.$refs.uToast.show({
							title: '提交成功！',
							type: 'default', 
							icon: false
						})
						setTimeout(function(){
							this.show=false;
							uni.navigateBack();
						},2000)
						
					}else{
						this.$refs.uToast.show({
							title: '提交失败，请稍后充实',
							type: 'default', 
							icon: false
						})
						this.show=false
					}
					
				})
			}
		}
	}
</script>

<style lang="scss">
	.shadow_con{
		box-shadow: 0 0 15rpx #ddd;
		border-radius: 10rpx;
		color:#555;
	}
	.list{
		padding:20rpx 0;
	}
	.warp {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 100%;
	}
	
	.rect {
		width: 220px;
		height: 180px;
		padding:20rpx;
		border-radius: 10rpx;
		background-color: #fff;
	}
	.rect textarea{
		width:94%;
		height:70%;
		padding:10rpx;
		font-size: 26rpx;
		border:1rpx solid #ddd;
	}
	.btn_con1{
		line-height: 60rpx;
		width:90%;
		height:60rpx;
		color:#fff;
		font-size: 28rpx;
		border-radius: 30rpx;
		background-image: url('https://resourse.cnlhjt.com/upload/20220825/d1aa35c1d129137d9b12c8f34e59c5bc.png');
		background-size: 100% 60rpx;
		// background-color: #006971;
	}
</style>

